{% load staticfiles %}

<header class="main-header">

    <a href="/" class="logo">
        <!-- mini logo for sidebar mini 50x50 pixels -->
        <span class="logo-mini"><b>管理</b></span>
        <!-- logo for regular state and mobile devices -->
        <span class="logo-lg"><b>教师评价管理系统</b></span>
    </a>
    <nav class="navbar navbar-static-top">
        <a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button">
            <span class="sr-only">Toggle navigation</span>
        </a>
        <div class="container-fluid">
            <!-- Collect the nav links, forms, and other content for toggling -->
            <div class="collapse navbar-collapse" id="navbar-collapse">
                <ul class="nav navbar-nav">
                    <li id="nav_home"><a href="{% url 'index' %}">首页</a></li>
                    <li id="nav_panel"><a href="{% url 'panel:index' %}">管理</a></li>
                    <li id="nav_rating"><a href="{% url 'rating:index' %}">评分</a></li>
                    <li id="nav_questionnaire"><a href="{% url 'questionnaire:index' %}">问卷</a></li>
                </ul>
                <ul class="nav navbar-nav navbar-right">
                    {% if user.is_authenticated %}
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown"><span
                                    class="glyphicon glyphicon-user"></span><span class="caret"></span></a>
                            <ul class="dropdown-menu" role="menu">
                                <li class="dropdown-header">Signed in as {{ user.username }}</li>
                                <li><a href="{% url 'profile' %}">Your profile</a></li>
                                <li><a href="{% url 'auth_logout' %}">Logout</a></li>
                            </ul>
                        </li>
                    {% else %}
                        <li><a href="{% url 'registration_register' %}">Register</a></li>
                        <li><a href="{% url 'auth_login' %}">Login</a></li>
                    {% endif %}
                </ul>
            </div>
            <!-- /.navbar-collapse -->
        </div>
        <!-- /.container-fluid -->
    </nav>
</header>
<script>
    var link = window.location.pathname;
    var parts = link.split('/');
    switch (parts[1]){
        case "panel":
            $('#nav_panel').addClass("active");
            break;
        case "rating":
            $('#nav_rating').addClass("active");
            break;
        default:
            $('#nav_home').addClass("active");
            break;
    }
</script>